package com.sskj.trafficcontrol;

import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.boot.web.support.SpringBootServletInitializer;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@SpringBootApplication
@ServletComponentScan   //Servlet、Filter、Listener 可以直接通过 @WebServlet、@WebFilter、@WebListener 注解自动注册，无需其他代码。
@EnableScheduling  //启动线程(task定时任务需要此注解)
@EnableTransactionManagement(proxyTargetClass = true)//事务管理
@MapperScan(basePackages = {"com.sskj.trafficcontrol.dao"})
/**
 * 使用外部的tomcat作为生产环境部署使用
 */
public class TrafficControlSysApplication extends SpringBootServletInitializer {
//public class TrafficControlSysApplication{
		public static void main(String[] args) {
			SpringApplication.run(TrafficControlSysApplication.class, args);

	}

	@Override
	protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
		return builder.sources(TrafficControlSysApplication.class);
	}

	@RequestMapping("/hello")
	public String index() {
		return "Hello World";
	}

}

/**
 * 使用内部的tomcat 开发使用
 */
/*public class TrafficControlSysApplication {
	public static void main(String[] args) {
		SpringApplication.run(TrafficControlSysApplication.class, args);

	}

	@RequestMapping("/hello")
	public String index() {
		return "Hello World";
	}
}*/
